﻿<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:fl="urn:metashell:filelist">
  
  <xsl:template match="/">
    
    <html>
    
      <head>
        <title>File List</title>
      </head>
    
      <body>
      
        <table>
          
          <thead>
            <tr>
              <th />
              <th>Name</th>
              <th>Created</th>
              <th>Accessed</th>
              <th>Modified</th>
              <th>Attributes</th>
            </tr>
          </thead>
          
          <tbody>
            
            <xsl:for-each select="fl:filelist/fl:dir | fl:filelist/fl:file">
              
              <tr>
              
                <td><img><xsl:attribute name="src">
                      <xsl:choose>
                        <xsl:when test="local-name() = 'dir'">icons/dir.png</xsl:when>
                        <xsl:otherwise>icons/file.png</xsl:otherwise>
                      </xsl:choose>
                </xsl:attribute></img></td>
                <td><xsl:value-of select="@fl:name" /></td>
                <td><xsl:value-of select="@fl:createtime" /></td>
                <td><xsl:value-of select="@fl:accesstime" /></td>
                <td><xsl:value-of select="@fl:modtime" /></td>
                <td /> <!-- Attributes will come later! -->
              </tr>
              
            </xsl:for-each>
            
          </tbody>
          
        </table>
      
      </body>
    
    </html>
    
  </xsl:template>
  
  <xsl:template match="dir">
    <tr>
      <td><img src="icons/dir.png" /></td>
      <td></td>
    </tr>
  </xsl:template>  
  
</xsl:stylesheet>
